<!doctype HTML>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// This tests for a crash when attempting to break a blockquote at the end of
// its content.
selection_test(
  [
    '<div contenteditable>',
      '<div>',
         '<blockquote type="cite">',
           '<div>one</div>',
           '<div>|<br></div>',
           '<div>two</div>',
         '</blockquote>',
      '</div>',
    '</div>',
  ],
  'insertNewlineInQuotedContent',
  [
    '<div contenteditable>',
      '<div>',
         '<blockquote type="cite">',
           '<div>one</div>',
           '<div><br></div>',
         '</blockquote>',
         '|<br>',
         '<blockquote type="cite">',
           '<div>two</div>',
         '</blockquote>',
      '</div>',
    '</div>',
  ],
  '1 insert BR at empty DIV.');

selection_test(
  [
    '<div contenteditable>',
      '<div>',
        '<blockquote type="cite">',
          '<div>one</div>',
          '<div><div><div>|<br></div></div></div>',
          '<div>two</div>',
        '</blockquote>',
      '</div>',
    '</div>',
  ],
  'insertNewlineInQuotedContent',
  [
    '<div contenteditable>',
      '<div>',
        '<blockquote type="cite">',
          '<div>one</div>',
          '<div><div><div><br></div></div></div>',
        '</blockquote>',
        '|<br>',
        '<blockquote type="cite">',
          '<div>two</div>',
        '</blockquote>',
      '</div>',
    '</div>',
  ],
  '2 insert BR at nested empty DIV.');

selection_test(
  [
    '<div contenteditable>',
      '<div>',
        '<blockquote type="cite">',
          '<div>one</div>',
          '<div><div><div>|<br>AB</div></div></div>',
          '<div>two</div>',
        '</blockquote>',
      '</div>',
    '</div>',
  ],
  'insertNewlineInQuotedContent',
  [
    '<div contenteditable>',
      '<div>',
        '<blockquote type="cite">',
          '<div>one</div>',
          '<div><div><div><br></div></div></div>',
        '</blockquote>',
        '|<br>',
        '<blockquote type="cite">',
          '<div><div><div>AB</div></div></div>',
          '<div>two</div>',
        '</blockquote>',
      '</div>',
    '</div>',
  ],
  '3 insert BR before BR and text');

selection_test(
  [
    '<div contenteditable>',
      '<div>',
        '<blockquote type="cite">',
          '<div>one</div>',
          '<div><div><div>|<br></div>AB</div></div>',
          '<div>two</div>',
        '</blockquote>',
   '</div>',
    '</div>',
  ],
  'insertNewlineInQuotedContent',
  [
    '<div contenteditable>',
      '<div>',
        '<blockquote type="cite">',
          '<div>one</div>',
          '<div><div><div><br></div></div></div>',
        '</blockquote>',
        '|<br>',
        '<blockquote type="cite">',
          '<div><div>AB</div></div>',
          '<div>two</div>',
        '</blockquote>',
      '</div>',
    '</div>',
  ],
  '4 insert BR at nested empty DIV and text');

selection_test(
  [
    '<div contenteditable>',
      '<div>',
        '<blockquote type="cite">',
          '<div>one</div>',
          '<div><div><div>|<br></div></div></div>',
          '<br>',
          '<div>two</div>',
        '</blockquote>',
   '</div>',
    '</div>',
  ],
  'insertNewlineInQuotedContent',
  [
    '<div contenteditable>',
      '<div>',
        '<blockquote type="cite">',
          '<div>one</div>',
          '<div><div><div><br></div></div></div>',
        '</blockquote>',
        '|<br>',
        '<blockquote type="cite">',
          '<br>',
          '<div>two</div>',
        '</blockquote>',
      '</div>',
    '</div>',
  ],
  '5 insert BR at nested empty DIV before BR');



selection_test(
  [
    '<div contenteditable>',
      '<blockquote type="cite">ab</blockquote>',
      '<blockquote type="cite">|<br></blockquote>',
    '</div>',
  ],
  'insertNewlineInQuotedContent',
  [
    '<div contenteditable>',
      '<blockquote type="cite">ab</blockquote>',
      '<blockquote type="cite"><br></blockquote>',
      '|<br>',
    '</div>',
  ],
  '6 insert BR in empty BLOCKQUOTE');
</script>
